#pragma once
#include "Base/BaseProcessor.h"
#include "Net/NetEntity.h"
#include "Net/Select.h"

class CConnectProcessor : public CBaseProcessor
{
public:
	CConnectProcessor();
	virtual ~CConnectProcessor();

public:
	virtual void tick() override;
	virtual int init();
	virtual int dispatchThreadMessage(CThreadMessage *msg) override;

public:
	bool initConnect(std::string ip, int port);
	bool initListen(int port);

private:
	CSocket mListenSocket;
	CSocket mConnectSocket;
	struct sockaddr_in mListenSockaddr;
	struct sockaddr_in mConnectSockaddr;
	CSelect mSelect;
};